﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Wyse.Server.Config
{
    /// <summary>
    /// Web server configuration
    /// </summary>
    [DataContract]
    public class WebServerConfig
    {
        [DataMember(Name="clientInterfacePort")]
        public int ClientIntfPort
        {
            get;
            set;
        }

        [DataMember(Name="adminIntfPort")]
        public int AdminIntfPort
        {
            get;
            set;
        }

        public bool Enable
        {
            get { return mEnable ?? true;}
            set
            {
                mEnable = value;
            }
        }

        [OnDeserialized()]
        internal void InitDefaults(StreamingContext context)
        {
            if (ClientIntfPort == 0)
                ClientIntfPort = 80;
            if (AdminIntfPort == 0)
                AdminIntfPort = 8080;
        }

        [DataMember(Name = "enable", IsRequired = false)]
        private bool? mEnable;
    }
}
